package com.small.xx.ai.file.dto;

/**
 * 文件上传响应DTO
 * 
 * @author xx-ai
 * @version 1.0.0
 */
public class FileUploadResponse {
    
    /**
     * 上传是否成功
     */
    private Boolean success;
    
    /**
     * 响应消息
     */
    private String message;
    
    /**
     * 上传的文件名
     */
    private String fileName;
    
    /**
     * 文件保存的完整路径
     */
    private String filePath;
    
    /**
     * 文件大小（字节）
     */
    private Long fileSize;
    
    /**
     * 文件类型
     */
    private String contentType;
    
    /**
     * 上传时间戳
     */
    private Long uploadTime;
    
    /**
     * 错误代码（如果有错误）
     */
    private String errorCode;

    // 构造器
    public FileUploadResponse() {}

    public FileUploadResponse(Boolean success, String message) {
        this.success = success;
        this.message = message;
        this.uploadTime = System.currentTimeMillis();
    }

    // 静态方法创建成功响应
    public static FileUploadResponse success(String fileName, String filePath, Long fileSize, String contentType) {
        FileUploadResponse response = new FileUploadResponse(true, "文件上传成功");
        response.setFileName(fileName);
        response.setFilePath(filePath);
        response.setFileSize(fileSize);
        response.setContentType(contentType);
        return response;
    }

    // 静态方法创建失败响应
    public static FileUploadResponse error(String message, String errorCode) {
        FileUploadResponse response = new FileUploadResponse(false, message);
        response.setErrorCode(errorCode);
        return response;
    }

    // Getter和Setter方法
    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public Long getUploadTime() {
        return uploadTime;
    }

    public void setUploadTime(Long uploadTime) {
        this.uploadTime = uploadTime;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    @Override
    public String toString() {
        return "FileUploadResponse{" +
                "success=" + success +
                ", message='" + message + '\'' +
                ", fileName='" + fileName + '\'' +
                ", filePath='" + filePath + '\'' +
                ", fileSize=" + fileSize +
                ", contentType='" + contentType + '\'' +
                ", uploadTime=" + uploadTime +
                ", errorCode='" + errorCode + '\'' +
                '}';
    }
}